﻿package mlc.haxe.input.parsing;

class GetIndexOf {

	public static function getIndexOf(string:String, value:String, startIndex:Int, ?escapeCharacters:Array<String>):Null<Int> {
		for (index in startIndex...string.length) {
			if (string.charAt(index) == value) {
				var found:Bool = true;
				for (escapeCharacter in escapeCharacters) {
					if (string.charAt(index - 1) == escapeCharacter) {
						found = false;
					}
				}
				if (found) {
					return index;
				}
			}
		}
		return null;
	}
}